package Herotestw;
//我是子类1
import ss.Hero;
//我调用了父类的包
public class Ultraman extends Hero {
    private String humanlikename;
    private String department;
    private Hero connect;

    //多态的尝试
    public String hero = "奥特曼";//隐藏掉父类的实例变量
    public void heroProtect(){
        System.out.println("奥特曼的守护 //Mark：子类覆盖父类方法");
    }
    public void ulProtect(){
        System.out.println("子类的普通方法");
    }

    public void heroConnection(){
        connect.connection();
        System.out.println("奥特曼的场合！！");
        super.connection();//妄图打出“梦幻联动”
    }

    public Ultraman(String name,String humanlikename, Hero connect){
        super(name);
        this.humanlikename =humanlikename;
        this.connect =connect;
    }
    public Ultraman(){
        //在多态的构造中运行时类型需要无参的构造方法
    }

    public Ultraman(String name, int age, int fightpower, int defendpower, String superpower, String humanlikename, String department, boolean standpoint,String maincolor,String typelike) {
        super(name, age, fightpower, defendpower, superpower,standpoint,maincolor,typelike);
        this.humanlikename = humanlikename;
        this.department = department;
    }

    public void setUltramanInfo(String inputn,int inputa, int inputf,int inputd,String inputs, String loadh, String loadd) {
        super.setHeroInfo(inputn,inputa);//父类方法一般在子类里用，主方法里测试
        super.setPower(inputf,inputd,inputs);
        System.out.println("请输入人间体名");
        humanlikename = loadh;
        department = loadd;
    }
    public void getUltramanInfo() {
        super.getHeroInfo();
        super.getPower();
    }
    //重写toString和toequals
    public String toString(){
        super.toString();
        return "人间体名[" + humanlikename + "] 地球防卫部名[" + department+"]";
    }
    public boolean equals(Object obj){
        if(obj instanceof Ultraman){
            Ultraman ul = (Ultraman) obj;
            if(this.humanlikename == ul.humanlikename && this.department == ul.department){
                return true;
            }
            else{
                return false;
            }
        }
        else{
            return false;
        }

    }
}
